package com.ttpai.boot.lbs.service;

import com.ttpai.boot.lbs.model.RoutePlanReportVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * Created by kail on 2017/3/5.
 */
@Service
public class CommonService {

    private static final Logger logger = LoggerFactory.getLogger(CommonService.class);

    public static Map<String, List<RoutePlanReportVO>> buildDynamicPlain(List<List<RoutePlanReportVO>> doPlanNotFormat) {
        Map<String, List<RoutePlanReportVO>> plan = new LinkedHashMap<>();
        Set<Long> repeat = new HashSet<>();

        for (List<RoutePlanReportVO> line : doPlanNotFormat) {
            plan.put(UUID.randomUUID().toString(), line); // key 是 检测师姓名

            for (RoutePlanReportVO point : line) {
                if (!repeat.add(point.getId())) {
                    logger.error("重复规划:{}", point.getId());
                }
            }
        }
        return plan;
    }

}
